define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {

	httpService.post(app.urls.dictionary_select,params,function(data){
		if("0000" === data.code){
			$scope.form = data.data[0];
		}else{
			alert(data.msg);
		}
	});
	$scope.saveForm = function(){
		if($scope.formCheck()){
			httpService.post(app.urls.dictionary_update,$scope.form,function(data){
				if("0000" === data.code){
					eventBusService.publish("content.page.reload.",data.data);
					eventBusService.publish("modal.page.close",{});
	    		}else{
	    			alert(data.msg);
	    		}
			});
		}
		
	}
	$scope.deleteById = function(){
		eventBusService.publish("modal.alert",{"content":"你是否确认删除这条数据？","isAutoClose":false,"confirm":function(){
			httpService.post(app.urls.dictionary_delete,{"ids":"'"+$scope.form.id+"'"},function(data){
				if("0000" === data.code){
					eventBusService.publish("content.page.reload.",data.data);
					eventBusService.publish("modal.page.close",{});
	    		}else{
	    			alert(data.msg);
	    		}
			});
		},"cancel":function(){
			//用户取消，不做操作
		}});
		
	}
}}});